!function(){"use strict";var t;!function(t){t.Anonymize="br.anonymize",t.GetAbTest="br.getAbTest",t.GetHtml="br.getHtml",t.GetRecommendation="br.getRecommendation",t.Identify="br.identify",t.LoadDependency="br.loadDependency",t.Notifications_isAvailable="br.notifications.isAvailable",t.Notifications_isSubscribed="br.notifications.isSubscribed",t.Notifications_subscribe="br.notifications.subscribe",t.Notifications_unsubscribe="br.notifications.unsubscribe",t.Ping="br.ping",t.ReloadWebLayers="br.reloadWebLayers",t.Segments_getSegments="br.segments.getSegments",t.Segments_subscribe="br.segments.subscribe",t.ShowHtml="br.showHtml",t.ShowWebLayer="br.showWebLayer",t.Start="br.start",t.Track="br.track",t.TrackEnhancedECommerce="br.trackEnhancedECommerce",t.TrackLink="br.trackLink",t.Update="br.update"}(t||(t={}));const e="v3.32.0",i="true"===String(!0),n="__exponea_etc__",r="__exponea_time2__",o="__exponea_tracking_definition__",s="__exponea_banner_event__",a="__exponea_last_session_ping_timestamp__",c="__exponea_last_session_start_timestamp__",h="exponea",l="Exponea",u="__exponea_ab_",d="__exponea_safari_push_subscribed__",p="__exponea__sync_modifications__",g="browser_push_notification",m="browser_push_notification_vapid_key",f="snippetVersion",b="exponea-editor-params",y="exponea-experiments-editor",w="/editor/",v=["runtime","polyfills","vendor","main"],k="webxpClient";class _{constructor(t,e,i,n){this.config=t,this.location=e,this.logger=i,this.storageUtils=n}error(t,...e){"string"==typeof t?this.print("error",t,...e):this.print("error",t)}log(t,...e){this.print("log",t,...e)}warn(t,...e){this.print("warn",t,...e)}debug(t,...e){this.print("debug",t,...e)}canPrintMessages(t="production",e=i){return"production"!==t&&e||this.config.getOptions().debug||this.location.search.includes(`${h}_debug=true`)||!!this.storageUtils.readBooleanFromStorage("localStorage",`${h}_debug`)}print(t,...e){this.canPrintMessages()&&this.logger[t](...e.filter((t=>void 0!==t)))}}const S=console,T={log:S.log,warn:S.warn,debug:S.debug,error:S.error};function E(t,e,i){t._&&t._.forEach((t=>{const n=t[0],r=t[1];if(n.includes(".")){const t=n.split("."),o=t[0],s=t[1];if(!(o in e))return i.error(`Failed to replay function call ${n}`),void i.error(`${o} does not exist on the object`);try{e[o][s].apply(e[o],r)}catch(t){i.error(`Failed to replay function call ${n}`,t)}}else try{e[n].apply(e,r)}catch(t){i.error(`Failed to replay function call ${n}`,t)}}))}function x(t,e,i){t.forEach((t=>{e[t]=i[t].bind(i)}))}class C{constructor(t){this.cookies=t}getAbTest(t,e){const i=`${u}${t}__`;let n=this.cookies.getCookie(i);return n||(n=this._selectAbTestVariant(e)),this.cookies.setCookie(i,n,"ab_test"),n}_selectAbTestVariant(t,e=Math.random()){let i=0;const n=Object.entries(t).map((([t,e])=>(i+=e,[t,i]))),r=Object.fromEntries(n),o=e*i;return Object.keys(r).find((t=>o{const n={};t.forEach((({key:t,value:i})=>{n[t]=this.materializeValue(i,e)})),i(n)}))}materializeIds(t,e,i){this.reporter.reportPromiseError(this.documentContentLoaded.whenLoaded()).then((()=>{if("anonymous"===t.type)i({});else if("registered"===t.type){const n=this.materializeValue(t.id,e);i(null===n?{}:{registered:n})}}))}_fetchRawValueFromElementList(t,e){const i=e[0];return i instanceof Element?"from_html"===t.type?i.innerHTML:"value"===t.attribute&&i instanceof HTMLInputElement?""!==i.value?i.value:null:i.getAttribute(t.attribute):null}_applyValueConverter(t,e){return t&&e&&"replace"===e.type?t.replace(new RegExp(e.regex,"gm"),e.replace):t}} /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */function P(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s}function L(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function z(t,e,i,n){return new(i||(i=Promise))((function(e,r){function o(t){try{a(n.next(t))}catch(t){r(t)}}function s(t){try{a(n.throw(t))}catch(t){r(t)}}function a(t){t.done?e(t.value):new i((function(e){e(t.value)})).then(o,s)}a((n=n.apply(t,[])).next())}))}function I(t){const e={};return Object.keys(t).forEach((i=>{switch(typeof t[i]){case"object":t[i]&&(e[i]=I(t[i]));break;case"function":e[i]=String(t[i]);break;default:e[i]=t[i]}})),e}var B,R,F;function j(t){return("0"+t.toString(16)).slice(-2)}function D(t,e=window){if(t%2)throw new Error("The length of the random string should be an even number!");const i=e.crypto||e.msCrypto;if(i&&i.getRandomValues&&Array.from){const e=new Uint8Array(t/2);return i.getRandomValues(e),Array.from(e,j).join("")}let n="";for(let e=0;enull!=t?t[e]:t),t));var r;return void 0===n?i:n}function U(t){return!Object.entries(t||{}).length&&!(null==t?void 0:t.length)&&!(null==t?void 0:t.size)}function N(t,e,i=!1){let n;return function(){const r=this,o=arguments;clearTimeout(n),!i||n?n=setTimeout((function(){n=null,t.apply(r,o)}),e):t.apply(r,o)}}function W(t){return null!=t&&"string"==typeof t.valueOf()}function q(t){return"function"==typeof t}function $(t,e){for(const i in t)t.hasOwnProperty(i)&&e(t[i],i,t);return t}function H(t){return null!==t&&"object"==typeof t}function G(t){return"[object Date]"===Object.prototype.toString.call(t)}function V(t,...e){const i=new WeakMap;function n(t,e){if("object"!=typeof t||null===t)return t;if(i.has(e))return i.get(e);i.set(e,t);for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const r=t[i],o=e[i];void 0===t[i]&&(K(o)?t[i]=n({},o):t[i]=o),K(r)&&K(o)&&(t[i]=n(r,o))}return t}return e.flat().filter(H).forEach((e=>n(t,e))),t}function K(t){if(!H(t))return!1;const e=Object.getPrototypeOf(t);if(null===e)return!0;const i=Object.prototype.hasOwnProperty.call(e,"constructor")&&e.constructor;return"function"==typeof i&&i instanceof i&&Function.prototype.toString.call(i)===Function.prototype.toString.call(Object)}function Q(t,e=new WeakMap){if(!H(t))return t;const i=t;if(e.has(i))return e.get(i);if(t instanceof Date)return new Date(t);if(Array.isArray(t)){const n=[];return e.set(i,n),t.forEach(((t,i)=>n[i]=Q(t,e))),n}const n={};e.set(i,n);for(const t in i)Object.prototype.hasOwnProperty.call(i,t)&&(n[t]=Q(i[t],e));return n}function J(t){return Q(t,new WeakMap)}function Z(t,e,i,n=""){if(!i)return"Other";const r=!!t.opr&&!!t.opr.addons||!!t.opera||/ OPR\//.test(i),o=!!!e.documentMode&&!!t.StyleMedia; // @cc_on!@ if(r)return/Mini/.test(i)?"Opera Mini":"Opera";if(o)return"Microsoft Edge";return/SAMSUNG|SGH-[I|N|T]|GT-[I|P|N]|SM-[N|P|T|Z|G]|SHV-E|SCH-[I|J|R|S]|SPH-L/i.test(i)?"Samsung Browser":/Chrome/.test(i)?"Chrome":/Apple/.test(n)?/Mobile/.test(i)?"Mobile Safari":"Safari":/Android/.test(i)?"Android Mobile":/Konqueror/.test(i)?"Konqueror":/Firefox/.test(i)?"Firefox":/MSIE/.test(i)||/Trident/.test(i)?"Internet Explorer":/Gecko/.test(i)?"Mozilla":"Other"}function X(t){if(!t)return"Other";const e={iPhone:"iPhone",iPad:"iPad",iPod:"iPod","Windows Phone":"Windows Phone",Android:"Android",BlackBerry:"(BlackBerry|BB10|PlayBook)"};for(const i in e){if(!e.hasOwnProperty(i))continue;if(new RegExp(e[i],"i").test(t))return i}return"Other"}function Y(t,e){return{os:(i=t.navigator.userAgent,i?/Windows/i.test(i)?/Phone/.test(i)?"Windows Mobile":"Windows":/(iPhone|iPad|iPod)/.test(i)?"iOS":/Android/.test(i)?"Android":/Mac/i.test(i)?"Mac OS X":/Linux/.test(i)?"Linux":"Other":"Other"),browser:Z(t,e,t.navigator.userAgent,t.navigator.vendor),device:X(t.navigator.userAgent)};var i}!function(t){t.str2ab8=function(t){const e=new ArrayBuffer(t.length),i=new Uint8Array(e);for(let e=0,n=t.length;e{this.resolveInitialization=t}))}initialize(){return z(this,0,void 0,(function*(){if(!this.window.crypto||!this.window.crypto.subtle)return this.debug.log("Crypto API is not available in this browser, browser extension communication is disabled"),void this.resolveInitialization(!1);const t=B.str2ab8(this.window.atob("MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEApOsQPnGejMMA3SWpmByzZaXlSla2IK2NLV11r4/Qd8MgjvT63cNkM/j3w2E/fCJ1C+cdDPTCZcXgUVFdSXvVAEmNscx/3SZBCvAfXVYUj3fkk00XPO425cSQ6368/fEoa8ocqFtHwSlHyaWZBerp6tfawkhvzJSk8sSfQB0slMyy/IsPQU/jwE9sCKjvPO3QcSTvslTyKSIVeVrxOMULA7HT2u9XaVzGd45l8KxdLfTd7o1XHBw2meA566tQ65Po/wy/3ycM7b8LXG6e+I7xCrHudTlLRVISkSx4Uh4XLJF47EwRIVCvtosY7AENjzLV56D9INCeVBv8GraYPtXJQ3iF65v4bPq8kjm+RNUWxzzLYpJ/tt5Utx5ZVogtN18iObVmw+sR+yY3rJOohUyPwSEhNRfQ9qGEJAImUuqOU6HSUHDD2QDfonsHKPwfEN1l5q3oyMIe73yjtulTUkk0MVPvV0F/v7kwLGZDyoskZ6aDuhSDJf/UTxCjzpbtuYX6VUQyid0X3Dr7fswvFn9ucZydNTW1ZOC/nszmu7Rl+Fk+OsEcTLM0CfZP+1n+bd17+UtIAl4rChmJGhEyz4c4/TFuACcaz8vlIeNZ+9MbXZ1VbI9kOB6roQzGQ2qpirKk1dtrV1Lb/6ODixSGtJ0ShcH7y0icxR8HK71j+oT4mN0CAwEAAQ==".trim())),e=this.window.crypto.subtle.importKey("spki",t,{name:"RSA-OAEP",hash:"SHA-256"},!0,["wrapKey"]),i=this.window.crypto.subtle.generateKey({name:"AES-GCM",length:256},!0,["encrypt"]),n=Promise.all([e,i]).then((([t,e])=>this.window.crypto.subtle.wrapKey("raw",e,t,{name:"RSA-OAEP"})));this.keys=Promise.all([i,n]).then((([t,e])=>({aes:t,aesEncrypted:e}))),e.catch((t=>{this.debug.error("Failed to import the encryption key used in BrowserExtension.Handler:",t)})),i.catch((t=>{this.debug.error("Failed to generate the encryption key used in BrowserExtension.Handler:",t)})),n.catch((t=>{this.debug.error("Failed to wrap the encryption key used in BrowserExtension.Handler:",t)})),yield this.keys.then((()=>this.resolveInitialization(!0)),(t=>{throw this.resolveInitialization(!1),t}))}))}sendPayload(t,e={type:"success"},i=Date.now()){const n=D(32,this.window),r=this.sendMessage({type:"payload",id:n,timestamp:i,state:e,payload:t});return t=>{(()=>{z(this,0,void 0,(function*(){yield r,yield this.updateState(n,t)}))})()}}updateState(t,e){return z(this,0,void 0,(function*(){yield this.sendMessage({type:"stateupdate",target:t,state:e})}))}sendMessage(t){return z(this,0,void 0,(function*(){if(!(yield this.isInitialized))return;if(!this.keys)throw new Error("BrowserExtension.Handler's keys must be assigned when initialization is resolved!");const e=I(t),i=B.str2ab16(JSON.stringify(e)),n=this.window.crypto.getRandomValues(new Uint8Array(16)).buffer;let r,o,s;try{({aes:r,aesEncrypted:o}=yield this.keys)}catch(t){return}try{s=yield this.window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},r,i)}catch(t){return void this.debug.error("Failed to encrypt the data before sending it to the extension:",t)}try{this.window.postMessage({data:s,key:o,iv:n,version:"webxp-js-client-message:v2"},"*")}catch(t){this.debug.error("Failed to send the encrypted data:",t)}}))}}}(R||(R={})),function(t){t.Ids="system/ids",t.Time="system/time",t.Tracking="system/tracking",t.Clicks="campaigns/clicks",t.Customers="crm/customers",t.Events="crm/events",t.PushNotificationsVapidKey="system/push-notifications-vapid-key"}(F||(F={}));const tt=new RegExp("[?&]+xnpe_cmp=([^&]*)","gi");class et{constructor(t,e,i,n,r,o,s,a){this.location=t,this.queue=e,this.config=i,this.timestamp=n,this.time=r,this.debug=o,this.window=s,this.document=a}parseUrlAndTrackCampaignClick(){const t=this.getCampaignClickTokenFromUrl();t&&this.trackClickEventWithToken(t)}getCampaignClickTokenFromUrl(){if(this.debug.log("Getting campaign click token from the URL"),this.location.search){const t=this.location.search.match(tt);if(t)return t[0].split("=")[1]}return null}trackClickEventWithToken(t){const e=this.timestamp.getTimestamp();this.debug.log("Tracking campaign click with token",t),this.queue.enqueue({name:F.Clicks,prepareData:t=>({data:{company_id:this.config.getToken(),age:t-e,url:this.location.href,timestamp:this.time.isTimeInitialized()?this.timestamp.getTimestampWithOffset():void 0,properties:Y(this.window,this.document)}})})}}const it=94608e3,nt=94608e3,rt=Object.freeze({hide_class:"xnpe_async_hide",timeout:4e3,mode:"async"});class ot{constructor(t,e={}){this.logger=t,this.options=ot.DEFAULT_OPTIONS,this.extendOptions(e)}getOptions(){return this.options}getToken(){if("string"!=typeof this.options.token)throw new Error("The token in config object is not set!");return this.options.token}getNewExperimentsOptions(){const t=this.getOptions().new_experiments;return!!t&&(!0===t?rt:Object.assign({},rt,t))}getActivityHandlerOptions(){const t=this.getOptions().ping.activity;return"object"==typeof t?t:{click:!0,key:!0,scroll:!0,move:!0}}extendOptions(t){void 0!==t.track_hash_changes&&this.logger.warn("Configuration option track_hash_changes is deprecated, use the spa_reloading.on_hash_change option instead"),this.options=V({},t,this.options)}setNewCustomerIds(t){this.options.customer=t}isSpaReloadingEnabled(t){return!0===this.getOptions().spa_reloading||!1!==this.getOptions().spa_reloading[t]}}ot.DEFAULT_OPTIONS=Object.freeze({target:"//api.exponea.com",token:null,utm_always:!1,customer:{},ping:{enabled:!0,interval:120,activity:!1,properties:{}},lazy_merge:!1,track:{auto:!0,visits:!1,visits_query_params:["pers_position","pers_content"],activity:!1,unloads:!1,exits:!0,default_properties:{},google_analytics:!0},modify:{enabled:!0,overlay:!1,delay:500},cookies:{cross_subdomain:!0,retrieve_callback:null,expires:{tracking:it,ab_test:nt,time:3600}},track_hash_changes:!0,transfer_identity:!0,error_reporting:"errors_only",debug:!1,utm_params:["utm_source","utm_medium","utm_campaign","utm_term","utm_content","gclid","campaign_id"],dependencies:{},webOptimization:!0,push:{safari:{websitePushID:null}},spa_reloading:!0,feature_flags:null,service_worker_path:"/service-worker.js",exposed_segments:{ttl:3e5,prefetch:!1,notify:!1,segmentation_processing_delay:5e3},compliance:{opt_in:!1},link_cookie:!1,data_layer:!1});class st{constructor(t,e){this.config=t,this.http=e}rewardBandit(t,e,i,n){const r=this.config.getOptions().target;this.http.post(`${r}/webxp/bandits/reward`,{reward_token:t,value:e},{credentials:"omit",responseType:"text"}).then((t=>t.body)).then(i,n)}}var at,ct,ht,lt,ut;function dt(t){return function(i,n,r){try{const o=r.type,s=r.operator,a=r.operands;if(at.whitelist.indexOf(s)>-1)return function(t,e,i,n){const r=t[i];switch(n){case at.isSet:return null!=r;case at.isNotSet:return null==r;case at.hasValue:return pt(e)?(null==r?void 0:r.length)>0:r+""!="";case at.hasNoValue:return pt(e)?0===(null==r?void 0:r.length):r+""==""}return!1}(i,o,n,s);if(function(t){return"string"===t}(o))return function(t,i,n,r){if(-1===ct.whitelist.indexOf(n))return e(n,"string"),!1;const o=t[i]+"";let s;switch(n){case ct.equals:return o===r[0].value;case ct.doesNotEqual:return o!==r[0].value;case ct.isIn:return s=r.map((t=>t.value)),s.indexOf(o)>-1;case ct.isNotIn:return s=r.map((t=>t.value)),-1===s.indexOf(o);case ct.contains:return o.indexOf(r[0].value)>-1;case ct.doesNotContain:return-1===o.indexOf(r[0].value);case ct.startsWith:return o.startsWith(r[0].value);case ct.endsWith:return o.endsWith(r[0].value);case ct.matchesRegex:return null!==new RegExp(r[0].value).exec(o)}return!1}(i,n,s,a);if(function(t){return"number"===t}(o))return function(t,i,n,r){if(-1===ht.whitelist.indexOf(n))return e(n,"number"),!1;const o=parseFloat(t[i]+""),s=parseFloat(r[0].value);switch(n){case ht.equalTo:return o===s;case ht.inBetween:return s<=o&&o<=parseFloat(r[1].value);case ht.lessThan:return os}return!1}(i,n,s,a);if(function(t){return"boolean"===t}(o))return function(t,i,n,r){if(-1===lt.whitelist.indexOf(n))return e(n,"boolean"),!1;const o=t[i]+"",s=r.value+"";if(n===lt.is)return o===s;return!1}(i,n,s,r);(function(t){return"date"===t})(o)&&t.error("Value filter: Date type is not supported."),pt(o)&&t.error("Value filter: List type is not supported.")}catch(e){t.debug("Value filter error:",e)}return t.debug("Invalid value filter:",r.operator),!1};function e(e,i){t.error("Contextual Bandits: operation "+e+" not suported for type "+i+".")}}function pt(t){return"list"===t}!function(t){t.isSet="is set",t.isNotSet="is not set",t.hasValue="has value",t.hasNoValue="has no value",t.whitelist=[t.isSet,t.isNotSet,t.hasValue,t.hasNoValue]}(at||(at={})),function(t){t.equals="equals",t.doesNotEqual="does not equal",t.isIn="in",t.isNotIn="not in",t.contains="contains",t.doesNotContain="does not contain",t.startsWith="starts with",t.endsWith="ends with",t.matchesRegex="regex",t.whitelist=[t.equals,t.doesNotEqual,t.isIn,t.isNotIn,t.contains,t.doesNotContain,t.startsWith,t.endsWith,t.matchesRegex]}(ct||(ct={})),function(t){t.equalTo="equal to",t.inBetween="in between",t.lessThan="less than",t.greaterThan="greater than",t.whitelist=[t.equalTo,t.inBetween,t.lessThan,t.greaterThan]}(ht||(ht={})),function(t){t.is="is",t.whitelist=[t.is]}(lt||(lt={}));class gt{constructor(t,e){this.contextualBandit=t,this.debug=e,this.optimizationTargets=[],this.eventFilterMatcher=dt(this.debug)}put(t,e,i,n){if(""===t)throw new Error("Event type can't be an empty string");if(""===i)throw new Error("Reward token can't be an empty string");this.optimizationTargets.push({eventType:t,valueFilters:e,rewardToken:i,rewardWeight:n})}reward(t,e){const{matchingTargets:i,remainingTargets:n}=this.optimizationTargets.reduce(function(t,e,i){return function(n,r){return r.eventType!==i?(n.remainingTargets.push(r),n):r.valueFilters.reduce(((i,n)=>i&&e(t,n.attribute.property,n.constraint)),!0)?(n.matchingTargets.push(r),n):(n.remainingTargets.push(r),n)}}(t,this.eventFilterMatcher,e),{matchingTargets:[],remainingTargets:[]});i.forEach((t=>{this.contextualBandit.rewardBandit(t.rewardToken,t.rewardWeight)})),this.optimizationTargets=n}}function mt(t,e){return e?(...i)=>{try{return e(...i)}catch(e){t.error(e)}}:e}!function(t){t.cookie="bre.cookie"}(ut||(ut={}));let ft=class{constructor(t,e,i,n){this.debug=t,this.window=e,this.config=i,this.logger=n}get isEnabled(){return!1!==this.config.getOptions().data_layer}get name(){const t=this.config.getOptions().data_layer;if("string"==typeof t){if(!t.length)throw this.debug.error("Data layer name is an empty string"),new Error("Data layer name is an empty string");return t}if(!0===t)return"dataLayer";throw this.debug.error("Data layer not configured properly"),new Error("Data layer not configured properly")}push(t){var e;this.isEnabled&&(this.window[this.name]=this.window[this.name]||[],null===(e=mt(this.logger,(()=>{this.window[this.name].push(t)})))||void 0===e||e())}};var bt;function yt(t){if("number"!=typeof t)return t;const e=new Date;return new Date(e.getTime()+1e3*t)}!function(t){t[t.defer=0]="defer",t[t.immediate=1]="immediate"}(bt||(bt={}));class wt{constructor(t,e,i,n,r,o,s,a,c,h){this.config=t,this.debug=e,this.logger=i,this.queue=n,this.location=r,this.document=o,this.segments=s,this.dataLayer=a,this.reporter=c,this.initializeState=h,this.lastSetCookie=""}getCookie(t){const e=this.document.cookie?this.document.cookie.split("; "):[];for(let i=0,n=e.length;i{this.queue.enqueue({name:F.Ids,isBlocking:!0,prepareData:()=>vt(this.config,{cookie:t}),processResponse:t=>{this.debug.log("received customer ids response",t);const e=t.data,i=e.cookie;this.debug.log("cookie received from server is "+i),this.setTrackingCookie(i),this.config.extendOptions({customer:e}),this.segments.prefetch()}},{process:bt.immediate})}))}setTrackingCookie(t){this.setCookie(n,t,"tracking"),this.lastSetCookie!==t&&this.dataLayer.push({event:ut.cookie,cookie:t,opt_in:this.config.getOptions().compliance.opt_in}),this.lastSetCookie=t}setFreshTrackingCookie(){const t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){const e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}));return this.setTrackingCookie(t),t}sanitizeCookieOptions(){let t=this.config.getOptions().cookies.expires;function e(t,e,i,n,r){"number"==typeof e&&e>0||G(e)&&e>new Date||("number"==typeof e?n.warn(`When specifying the number of seconds for cookies.expires.${t}, you have to use a positive number. You passed in '${e}'. The SDK will use the default value of ${i}. Read more at\nhttps://docs.exponea.com/docs/configuration#cookies-options`):G(e)?n.warn(`When specifying a Date for cookies.expires.${t}, you have to use a date in the future. You passed in '${e}'. The SDK will use the default value of ${i}. Read more at\nhttps://docs.exponea.com/docs/configuration#cookies-options`):n.warn(`You can only use a number or a Date object for cookies.expires.${t}, not '${typeof e}'. The SDK will use the default value of ${i}. Read more at\nhttps://docs.exponea.com/docs/configuration#cookies-options`),r.extendOptions({cookies:{expires:{[t]:i}}}))}H(t)&&!G(t)||(t={tracking:t,ab_test:t,time:t},this.config.extendOptions({cookies:{expires:t}})),e("tracking",t.tracking,it,this.logger,this.config),e("ab_test",t.ab_test,nt,this.logger,this.config),e("time",t.time,3600,this.logger,this.config)}parseCookieValue(t){0===t.indexOf('"')&&(t=t.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return t=decodeURIComponent(t.replace(/\+/g," "))}catch(e){return this.debug.error("error while parsing cookie value, ignoring",e),t}}}function vt(t,e){const i=t.getOptions().cookies.expires,n=Object.assign({},t.getOptions().customer);return delete n.cookie,{data:{project_id:t.getToken(),cookie:e.cookie,tifc:e.tifc,customer:n,expires:Math.floor(yt(i.tracking).getTime()/1e3)}}}function kt(t){setTimeout(t)}function _t(){return function(t,e,i){const n=i.value,r=Date.now(),o=n.name;return i.value=function(){try{return n.apply(this,arguments)}catch(t){throw this.reporter.sendErrorReport(t,o,r),t}},i}}const St=Object.freeze({immediate:!1});class Tt{constructor(t,e,i,n,r,o,s,a,c,h,l,u,d){this.reporter=t,this.config=e,this.contextualBanditEventFilter=i,this.time=n,this.timestamp=r,this.queue=o,this.debug=s,this.document=a,this.location=c,this.initializeState=h,this.window=l,this.url=u,this.browserExtension=d,this.eventTrackingListeners=[]}track(t,e={},i={},n=!1){const r=this.timestamp.getTimestamp(),o=Object.assign({},this.config.getOptions().customer);this.reporter.reportPromiseError(this.initializeState.whenInitialized()).then((()=>{const n=Object.assign({},St,i),s=Object.assign(Object.assign(Object.assign(Object.assign({location:this.location.href},Y(this.window,this.document)),this.getUtmParamsIfEnabled()),this.getTrackDefaultPropertiesIfEnabled()),e);this.contextualBanditEventFilter.reward(s,t);const a=this.browserExtension.sendPayload({type:"event",eventType:t,eventProperties:s},{type:"pending"});this.queue.enqueue({name:F.Events,prepareData:e=>{(null==o?void 0:o.cookie)||(o.cookie=this.config.getOptions().customer.cookie),this.debug.log("Tracking event: "+t,s);const i={customer_ids:o,company_id:this.config.getToken(),type:t,age:e-r,properties:s};this.time.isTimeInitialized()&&(i.timestamp=this.timestamp.getTimestampWithOffset());try{this.triggerEventTrackingListeners(t,s)}catch(t){this.debug.error("Error triggering event tracking listeners",t)}return{data:i}},processResponse:(t,e,i)=>{kt((()=>{var r;return null===(r=n.successCallback)||void 0===r?void 0:r.call(n,t,e,i)})),a({type:"success"})},processError:t=>{kt((()=>{var e;return null===(e=n.errorCallback)||void 0===e?void 0:e.call(n,t)})),a({type:"error",error:String(t)})}},{process:n.immediate?bt.immediate:bt.defer})})).then((()=>{("web_unload"===t||"user_active"===t&&n)&&this.queue.sendBulkWithBeacon()}))}getUtmParamsIfEnabled(){const t=this.config.getOptions();if(t.utm_always){return t.utm_params?this.url.getParams(t.utm_params):{}}return{}}getTrackDefaultPropertiesIfEnabled(){const t=this.config.getOptions();return t.track&&t.track.default_properties?t.track.default_properties:{}}registerEventTrackingListener(t){this.eventTrackingListeners.push(t)}trackPageVisitEventIfEnabled(){const t=this.config.getOptions().track;t&&t.visits&&(this.trackPageVisitEvent(),this.config.isSpaReloadingEnabled("visits")&&this.url.onChange("trackPageVisitOnUrlChange",(()=>{this.trackPageVisitEvent()})))}trackPageVisitEvent(){this.track("page_visit",Object.assign({referrer:this.document.referrer,location:this.location.href,path:this.location.pathname},this.url.getParams(this.config.getOptions().track.visits_query_params)))}triggerEventTrackingListeners(t,e){for(let i=0;i10)throw new Error(`Maximum number of retries reached while waiting for window.ga to appear (already waited for ${500*n}ms). window.gtag is available but it does not appear to load window.ga anymore!`);if(e.ga)return t.log(`window.ga is available after ${n} retries`),void e.ga(i);if(e.gtag)return t.log(`window.gtag is available, trying ${n} retry`),void e.setTimeout(Et.bind(void 0,t,e,i,n+1),500);throw new Error("No window.ga nor window.gtag is available in waitForGoogleAnalyticsSdkToLoad!")}var xt,Ct;!function(t){t.BannersShow="campaigns/banners/show",t.ExperimentsShow="campaigns/experiments/show",t.HtmlGet="campaigns/html/get",t.ManagedTagsShow="managed-tags/show",t.Recommendation="optimization/recommend/user",t.WebOptimization="webxp/projects//bundle",t.Segments="webxp/projects//segments?cookie=",t.LinkIds="webxp/projects//cookies//link-ids"}(xt||(xt={})),function(t){t.Internal="internal"}(Ct||(Ct={}));class Ot{constructor(t,e,i,n,r,o,s,a,c){this.reporter=t,this.config=e,this.queue=i,this.debug=n,this.initializeState=r,this.window=o,this.cookies=s,this.browserExtension=a,this.segments=c}requestCustomerIdsFromServer(t,e=(()=>{})){this.queue.enqueue({name:F.Ids,isBlocking:!0,prepareData:()=>vt(this.config,t),processResponse:t=>{this.debug.log("received customer ids response",t);const i=t.data,n=i.cookie;this.debug.log("cookie received from server is "+n),this.cookies.setTrackingCookie(n),this.config.extendOptions({customer:i}),e(i),this.segments.prefetch(),this.segments.notify()}},{first:!0})}filterEmptyCustomerIds(t){const e={};for(const i in t)!t.hasOwnProperty(i)||null!==t[i]&&void 0!==t[i]&&""!==t[i]?e[i]=t[i]:this.debug.log("Removed empty customer id: "+i,t[i]);return e}identifyCustomerWithGoogleAnalyticsId(){const t=this.config.getOptions();t.customer&&t.customer.google_analytics||t.track.google_analytics&&(!function(t){return"ga"in t||"gtag"in t}(this.window)?this.debug.warn("Missing Google Analytics SDK (window.ga and window.gtag are not defined). Either integrate Google Analytics with your website or disable Google Analytics integration in the SDK config:\nhttps://docs.exponea.com/docs/config-object"):!function(t){return"ga"in t&&"function"!=typeof t.ga}(this.window)?Et(this.debug,this.window,(()=>{if(!this.window.ga||!this.window.ga.getAll)throw new Error("window.ga is missing the getAll function");const e=this.window.ga.getAll();if(!e)return;const i=function(t){var e;const i=t.find((t=>{var e;return null===(e=t.get)||void 0===e?void 0:e.call(t,"clientId")}));return null===(e=null==i?void 0:i.get)||void 0===e?void 0:e.call(i,"clientId")}(e);i&&(this.config.extendOptions({customer:Object.assign(Object.assign({},t.customer),{google_analytics:i})}),this.updateCustomer({}))})):this.debug.warn("Incorrect Google Analytics SDK detected (window.ga is "+typeof this.window.ga+"). Are you using an old Google Analytics SDK? This is not supported in the SDK so Google Analytics integration will not work. Either upgrade the Google Analytics SDK or disable Google Analytics integration in the SDK config:\nhttps://docs.exponea.com/docs/config-object"))}updateCustomer(t,e=(()=>{}),i=(()=>{}),n=!1){const r=Object.assign({},this.config.getOptions().customer);this.reporter.reportPromiseError(this.initializeState.whenInitialized()).then((()=>{this.queue.enqueue({name:F.Customers,prepareData:()=>{const e=Object.assign({},t);return(null==r?void 0:r.cookie)||(r.cookie=this.config.getOptions().customer.cookie),{data:{ids:r,company_id:this.config.getToken(),properties:e}}},processResponse:e,processError:i},{process:n?bt.immediate:bt.defer})}))}linkCustomerIds(t=(()=>{}),e=(()=>{}),i=!1){this.reporter.reportPromiseError(this.initializeState.whenInitialized()).then((()=>{this.queue.enqueue({name:xt.LinkIds,allowedToFail:!0,noBulk:!0,prepareData:()=>({data:{external_ids:this.config.getOptions().customer}}),processResponse:t,processError:e},{process:i?bt.immediate:bt.defer})}))}identifyCustomer(t,e={},i=(()=>{}),n=(()=>{}),r=!1,o,s){"string"!=typeof t&&"number"!=typeof t||(t={registered:t});const a=this.config.getOptions().customer,c=this.filterEmptyCustomerIds(t);c.cookie=a.cookie,a.google_analytics&&(c.google_analytics=a.google_analytics),this.debug.log("Identifying customer: ",c),this.browserExtension.sendPayload({type:"ids",ids:c}),this.config.extendOptions({customer:c}),this.updateCustomer(e,i,n,r),o&&this.linkCustomerIds(o,s,r)}}class At{constructor(t){this.config=t,this.DEFAULT_DEPENDENCIES={exp:"https://exp-framework.exponea.com/exp.js"},this.loadedDependencies=new Map}get options(){return this.config.getOptions()}loadDependency(t){let e;e="[object Array]"===Object.prototype.toString.call(t)?t:[t];try{const t=this.getDependencyUrls(e);return this.getDependencyLoadingChain(t)}catch(t){return Promise.reject(t)}}getDependencyUrls(t){const e=[];for(const i of t){let t=this.DEFAULT_DEPENDENCIES[i];if(this.options.dependencies&&this.options.dependencies[i]&&(t=this.options.dependencies[i]),!t)throw new Error(`unknown dependency named '${i}'`);e.push(t)}return e}getDependencyLoadingChain(t){let e=Promise.resolve();for(const i of t)e=e.then((()=>this.loadDependencyFromUrl(i)));return e}loadDependencyFromUrl(t){const e=this.loadedDependencies.get(t);if(e)return e;const i=new Promise(((e,i)=>{const n=document.getElementsByTagName("head")[0]||document.documentElement,r=document.createElement("script");r.src=t;let o=!1;r.onload=r.onreadystatechange=function(){o||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(o=!0,e(),r.onload=r.onreadystatechange=null,n&&r.parentNode&&n.removeChild(r))},r.onerror=function(e){const n="message"in e?`: ${e.message}`:"";i(new Error(`Loading of dependency '${t}' failed${n}`))},r.onabort=function(){i(new Error(`Loading of dependency '${t}' was aborted`))},n.insertBefore(r,n.firstChild)}));return this.loadedDependencies.set(t,i),i}}class Pt{constructor(t,e){this.window=t,this.document=e}whenLoaded(){return this.loadedPromise||(this.loadedPromise=new Promise((t=>function(t,e,i){let n=!1,r=!0;const o=e.documentElement,s="addEventListener"in e?"addEventListener":"attachEvent",a="removeEventListener"in e?"removeEventListener":"detachEvent",c="addEventListener"in e?"":"on";if("complete"===e.readyState)i.call(t,"lazy");else{if(e.createEventObject&&o.doScroll){try{r=!t.frameElement}catch(t){}r&&function e(){try{o.doScroll("left")}catch(t){return void setTimeout(e,50)}n=!0,i.call(t,"poll")}()}e[s](c+"DOMContentLoaded",h,!1),e[s](c+"readystatechange",h,!1),t[s](c+"load",h,!1)}function h(r){if("readystatechange"===r.type&&"complete"!==e.readyState)return;const o="load"===r.type?t:e;o[a].bind(o)(c+r.type,h,!1),n||(n=!0,i.call(t,r.type))}}(this.window,this.document,t)))),this.loadedPromise}}var Lt,zt;!function(t){const e=["id","name","price","brand","category","variant","list","position"],i=["product_id","name","price","brand","category","variant","list","position"],n=["currencyCode"],r=["currency_code"],o=["id","name","brand","category","variant","price","quantity","coupon","position"],s=["product_id","name","brand","category","variant","price","quantity","coupon","position"],a=["id","affiliation","revenue","tax","shipping","coupon","list","step","option"],c=["transaction_id","affiliation","revenue","tax","shipping","coupon","list","step","option"],h=["id","name","creative","position"],l=["promo_id","name","creative","position"];function u(t,e,i,n=i){i.forEach(((i,r)=>{const o=n[r];e.hasOwnProperty(i)&&e[i]&&(t[o]=e[i])}))}function d(t,e){u(t,e,n,r)}function p(t,e){u(t,e,a,c)}t.Tracker=class{constructor(t,e){this.debug=t,this.eventTracker=e}trackEnhancedEcommerce(t,e="all"){K(t)?("impressions"!==e&&"all"!==e||this.trackProductImpressions(t),"click"!==e&&"all"!==e||this.trackProductAction(t,"click","product_click"),"detail"!==e&&"all"!==e||this.trackProductAction(t,"detail","product_detail"),"add"!==e&&"all"!==e||this.trackProductAction(t,"add","product_add_to_cart"),"remove"!==e&&"all"!==e||this.trackProductAction(t,"remove","product_remove_from_cart"),"promoView"!==e&&"all"!==e||this.trackPromotionAction(t,"promoView","promo_impression"),"promoClick"!==e&&"all"!==e||this.trackPromotionAction(t,"promoClick","promo_click"),"checkout"!==e&&"all"!==e||this.trackCheckout(t),"checkout_option"!==e&&"all"!==e||this.trackCheckoutOption(t),"purchase"!==e&&"all"!==e||this.trackPurchase(t),"refund"!==e&&"all"!==e||this.trackRefund(t)):this.debug.error("Ecommerce parameter is not a plain object")}trackProductImpressions(t){t.impressions?t.impressions.forEach((n=>{const r={};d(r,t),u(r,n,e,i),this.trackEnhancedEcommerceEvent("product_impression",r)})):this.debug.warn("There are no impressions in the ecommerce object")}trackProductAction(t,e,i){var n;const r=t[e];if(!r)return void this.debug.debug(`${e} not found in the ecommerce object`);if(!r.products)return void this.debug.debug(`${e} in the ecommerce object does not have any products`);const a=null!==(n=r.actionField)&&void 0!==n?n:{};r.products.forEach((e=>{const n={};d(n,t),p(n,a),u(n,e,o,s),this.trackEnhancedEcommerceEvent(i,n)}))}trackPromotionAction(t,e,i){const n=t[e];n?n.promotions?n.promotions.forEach((e=>{const n={};d(n,t),u(n,e,h,l),this.trackEnhancedEcommerceEvent(i,n)})):this.debug.debug(`${e} in the ecommerce object does not have any promotions`):this.debug.debug(`${e} not found in the ecommerce object`)}trackCheckout(t){var e;if(!t.checkout)return void this.debug.debug("There is no checkout in the ecommerce object");this.trackProductAction(t,"checkout","product_checkout");const i=null!==(e=t.checkout.actionField)&&void 0!==e?e:{},n={};d(n,t),p(n,i),this.trackEnhancedEcommerceEvent("checkout",n)}trackCheckoutOption(t){var e;if(!t.checkout_option)return void this.debug.debug("There is no checkout option in the ecommerce object");const i=null!==(e=t.checkout_option.actionField)&&void 0!==e?e:{},n={};d(n,t),p(n,i),this.trackEnhancedEcommerceEvent("checkout_option",n)}trackPurchase(t){var e;if(!t.purchase)return void this.debug.debug("There is no purchase in the ecommerce object");this.trackProductAction(t,"purchase","product_purchase");const i=null!==(e=t.purchase.actionField)&&void 0!==e?e:{},n={};d(n,t),p(n,i),this.trackEnhancedEcommerceEvent("transaction",n)}trackRefund(t){var e;if(!t.refund)return void this.debug.debug("There is no refund in the ecommerce object");const i=null!==(e=t.refund.actionField)&&void 0!==e?e:{},n={};d(n,t),p(n,i),t.refund.products?(n.refund_type="partial",this.trackProductAction(t,"refund","product_refund")):n.refund_type="full",this.trackEnhancedEcommerceEvent("refund",n)}trackEnhancedEcommerceEvent(t,e){this.eventTracker.track(t,Object.assign({tracked_via:"eecommerce"},e))}}}(Lt||(Lt={}));class It{constructor(t,e,i){this.debug=e,this.reporter=i,this.reportablePromise=t.then((t=>t)).catch((t=>Promise.reject(t)))}then(t){const e=this.reportablePromise.then((e=>{const i=Date.now();let n;try{n=t(e)}catch(t){throw this.debug.error(t),this.reporter.sendErrorReport(t,"promise",i),t}return n instanceof It?n.reportablePromise:n}));return new It(e,this.debug,this.reporter)}catch(t){const e=this.reportablePromise.catch((e=>{const i=Date.now();let n;try{n=t(e)}catch(t){throw this.debug.error(t),this.reporter.sendErrorReport(t,"promise",i),t}return n instanceof It?n.reportablePromise:n}));return new It(e,this.debug,this.reporter)}}class Bt{constructor(t,e,i,n=Math){this.debug=t,this.math=n,this._target="//sdk-tracing.exponea.com/webxp-trace/record/browser/v1",this.config=e,this.http=i}reportError(t,e){return this._reportError(t,e)}sendErrorReport(t,e,i=Date.now(),n={},r=.01){if(this.math.random()>r)return;const o=this.serialize(t,e,i,n);this.debug.log("Sending error report",o),this._sendErrorReport(o).then((()=>{this.debug.log("Error report was successfully sent")})).catch((t=>{this.debug.error("Error while sending the error report",t)}))}serialize(t,i,n,r={}){let o;return o=t instanceof Error?t:new Error(String(t)),{id:D(32),instance_id:"EXP",sdk_version:e,company_id:this.config.getToken(),spans:[{id:D(16),start_time:n/1e3,duration:(Date.now()-n)/1e3,operation:i,error:{message:o.message,name:o.name,stack:o.stack||""},tags:Object.assign({url:location.href.split(/[?#]/)[0],host:location.hostname},r)}]}}reportPromiseError(t){return new It(t,this.debug,this)}_reportError(t,e){const i=this;return function(){const n=Date.now();try{return t(...arguments)}catch(r){const o=e||t.name||"transientOperation";throw i.sendErrorReport(r,o,n),r}}}_sendErrorReport(t){return this.http.post(this._target,t,{responseType:"text",headers:{"Content-type":"application/json"},credentials:"omit"})}}class Rt{constructor(t,e,i,n,r,o,s){this.reporter=t,this.config=e,this.queue=i,this.debug=n,this.newExperiments=r,this.url=o,this.window=s}loadFlickeringExperimentsScript(t){if(this.newExperiments.areAlreadyApplied())return void this.debug.log("Not applying experiments with the SDK because new_experiments are enabled.");this.queue.enqueue({httpMethod:void 0,noBulk:!0,name:Ct.Internal,action:()=>{Ft(t,this.config)},prepareData:()=>{},processResponse:()=>{},processError:()=>{}});let e=!1;this.config.isSpaReloadingEnabled("experiments")&&this.url.onChange("onUrlChangeBeforeWebxpClient",(()=>{var t;(null===(t=this.window[k])||void 0===t?void 0:t.config)||(e=!0)})),t.promise.then((t=>{let i=!1;this.config.isSpaReloadingEnabled("experiments")&&(e&&t.reset&&(t.reset(),e=!1),this.url.onChange("onUrlChangeFilterAndApplyExperiments",(()=>{var e;if(i)return;const n=!(null===(e=this.window[h])||void 0===e?void 0:e.configuration),r=t!==this.window[k];if(n||r)return t.revert&&t.revert(),void(i=!0);t.reset&&t.reset("page_load")})))}))}}function Ft(t,e){var i;const n=e.getOptions();n.customer.cookie||t.reject(new Error("Can't load flickering experiments - missing cookie."));const r=encodeURIComponent(window.location.href),o=function(t){let e;t.cookies&&t.cookies.expires&&("number"==typeof t.cookies.expires||G(t.cookies.expires)?e=yt(t.cookies.expires):t.cookies.expires.tracking&&("number"==typeof t.cookies.expires.tracking||G(t.cookies.expires.tracking))&&(e=yt(t.cookies.expires.tracking)));e&&e{var e;"function"==typeof(null===(e=window[k])||void 0===e?void 0:e.reset)?t.resolve(window[k]):t.reject("webxpClient.reset doesn't exist or not a function")},l.onerror=e=>t.reject(e);const u=document.getElementsByTagName("script")[0];u&&u.parentNode&&u.parentNode.insertBefore(l,u)}class jt{constructor(t,e,i,n,r,o,s,a){this.http=t,this.config=e,this.location=i,this.document=n,this.history=r,this.window=o,this.debug=s,this.storageUtils=a,this.urlParamsMatch=null,this.urlParamsMatchBase64=null}matchUrlWithParams(){this.urlParamsMatch=this.location.href.match("(#|\\?)?exponea-editor-params=((%7B|{).*(%7D|}))"),this.urlParamsMatchBase64=this.location.href.match("(?:#|\\?)?exponea-editor-params=([a-zA-Z0-9-_=]+)")}areEditorParamsInURL(){return!!this.urlParamsMatch||!!this.urlParamsMatchBase64}placeParamsFromURLToStorage(){let t="";if(this.urlParamsMatch&&(t=decodeURIComponent(this.urlParamsMatch[2])),this.urlParamsMatchBase64){const e=this.urlParamsMatchBase64[1].replace(/-/g,"+").replace(/_/g,"/");t=atob(e)}t&&(this.storageUtils.writeToStorage("sessionStorage",b,t)||this.debug.warn("The editor is not supported in this browser"))}removeParamsFromURL(){let t="";this.urlParamsMatch&&(t=this.urlParamsMatch[0]),this.urlParamsMatchBase64&&(t=this.urlParamsMatchBase64[0]),t&&(this.history&&this.history.replaceState?this.history.replaceState(null,this.document.title,this.location.href.replace(t,"")):this.location.href=this.location.href.replace(t,""))}shouldStartEditor(){return!!this.storageUtils.readStringFromStorage("sessionStorage",b)}bootstrapEditor(){return this.isEditorRunning()?(this.debug.log("The editor is already running"),Promise.resolve()):this.location.host.indexOf("localhost")>=0?(this.debug.log("Auto-launching of the editor is disabled in development environments"),Promise.resolve()):this._waitForPageToLoad().then((()=>{this._insertEditorLoadingElement();const t=this._insertEditorIframe();return this.http.get(this.config.getOptions().target+"/editor/index.html?timestamp="+(new Date).getTime(),{responseType:"text"}).then((t=>t.body)).then((e=>{if(t){const i=e.replace(/base\shref=".*"/,`base href="${this.config.getOptions().target}${w}"`);t.srcdoc=i}else this.debug.error("The created iframe's content document is null! Is the iframe in the DOM?")})).catch((()=>this.http.get(this.config.getOptions().target+"/editor/version.txt?timestamp="+(new Date).getTime(),{responseType:"text"}).then((e=>{const i=e.body.trim();this.debug.log(`Fetching editor version ${i}`);const n=v.map((t=>`